package titt.head;

import java.util.Arrays;

import titt.util.Bytes;

public class Header {
	private final String name, value;
	private final byte[] bytes;
	
	public Header(String name, String value) {
		this(name, Bytes.asBytes(value));
	}
	public Header(String name, byte[] value) {
		this.name = name;
		this.value = Bytes.asString(value);
		this.bytes = value;
	}
	
	public String getName() {
		return name;
	}
	public String getValue() {
		return value;
	}
	public byte[] getByteValue() {
		return bytes;
	}
	
	@Override
	public boolean equals(Object o) {
		if(!(o instanceof Header)) return false;
		return getName().equals(((Header)o).getName()) && Arrays.equals(getByteValue(), ((Header)o).getByteValue());
	}
}
